<template>
    <div class="newsinfo-box">
        <!-- 雷二丫粗来挨打 -->
        <h3>{{newsInfo.title}}</h3>
        <div class="time-click">
            <span>创建时间: {{newsInfo.add_time|dateFormat}}</span>
            <span>点击次数: {{newsInfo.click}}次</span>
        </div>
        <hr>
        <div v-html="newsInfo.content"></div>

        <comment :id="this.id"></comment>
    </div>
</template>

<script>
import comment from '../common/comment.vue'

export default {
    data(){
        return {
            id: this.$route.params.id,
            newsInfo: {}
        }
    },
    created(){
        this.getNewsInfo()
    },
    methods:{
        getNewsInfo() {
            this.$http.get("api/getnew/" + this.id).then(result =>{
                this.newsInfo = result.body.message[0];
                console.log(this.newsInfo)
            })
        }
    },
    components:{
        comment
    }
}
</script>

<style lang="scss">
.newsinfo-box{
    padding: 0 3px;
    h3{
        font-size: 14px;
        text-align: center;
    }
    .time-click{
        display: flex;
        justify-content: space-between;
        font-size: 12px;
        color: #26a2ff;
    }
    p{
        font-size: 12px;
    }
} 
</style>